/* 
 * File:   gamescreen.h
 * Author: cow
 *
 * Created on March 1, 2011, 11:20 PM
 */

#ifndef _GAMESCREEN_H
#define	_GAMESCREEN_H

//includes-----------------------------
#include "widgetSwap.h"
#include "mapIcons.h"
#include "cursor.h"
#include "../worldata/directs.h"
//stdlib----------------------
#include <sstream>
//gtk-------------------------
#include <gtkmm/drawingarea.h>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <gtkmm/layout.h>
#include <gtkmm/treeview.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/cellrenderertext.h>
#include <gtkmm/scrolledwindow.h>
//glib------------------------
#include <glibmm/refptr.h>
//cairo-----------------------
#include <cairomm/context.h>
#include <cairomm/refptr.h>

using namespace std;
//defines------------------------------
#define gscrDbgMsg false

#define minIconWid 80
#define minIconHgt 80
#define minInfoWid 80
#define minInfoHgt 1000

//prototypes---------------------------
class mapScreen;
class infoScreen;
class gameContainer;

//definitions--------------------------
class mapScreen : public Gtk::DrawingArea, public cursorServer{
public:
    mapScreen();
    ~mapScreen();
    void connectParent(gameContainer* par);
    //drawing functions
    void draw();
    void scroll();
    void scroll(direction dir, int dist);
    //cursor functions
    bool keypress(GdkEventKey* key);
    //math
    void recalculateBounds();
protected:
    virtual bool on_expose_event(GdkEventExpose* event);
    virtual bool on_key_press_event(GdkEventKey* key);
private:
    gameContainer* parent;
    //drawing aids
    int bounds[4][2][2];
    int offset[2];
    int tileDims[2];
    int pixelOffset[2];
};
class infoScreen : public Gtk::VBox, public cursorListener{
public:
    infoScreen();
    ~infoScreen();
    void connectParent(gameContainer* par);
    void displayInfo(string str);
    void redraw();
protected:
    virtual void signal_curs_move(int x, int y);
    virtual void signal_curs_enter(int x, int y);
private:
    gameContainer* parent;
    Gtk::DrawingArea iconSpace;
    Gtk::TreeView statistics;
    Gtk::TreeModel statisticsBacking;
    int icnId, cx, cy;
};
class gameContainer : public Gtk::Layout{
public:
    gameContainer();
    ~gameContainer();
    //cursor access
    cursorServer* getCursor();
protected:
private:
    mapScreen mapdisp;
    infoScreen infdisp;
};

#endif	/* _GAMESCREEN_H */

